package com.csdn.listener;


import com.csdn.config.BaseConfig;
import com.csdn.config.Desc;
import org.reflections.Reflections;

import java.lang.annotation.Annotation;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class Test {
    public static void main(String[] args) {
        Reflections reflections = new Reflections("com.csdn");
        Set<Class<? extends BaseConfig>> subTypesOf = reflections.getSubTypesOf(BaseConfig.class);
        Map<String,Class<? extends BaseConfig>> collectMap = subTypesOf.stream().collect(Collectors.toMap(s -> s.getDeclaredAnnotation(Desc.class).value(), s -> s));
        System.out.println(collectMap);
    }
}
